#!/opt/bin/bash

## Include Functions & Constants ##
source rsyncOptions.sh

## Local variables ##
source /opt/localVariables.sh

if [ "$DOC_DIR_TO_BCK" != "" ] && [ "$DOC_TARGET_DIR" != "" ] && [ "$BCK_USER" != "" ] && [ "$SSH_KEY_FILE" != "" ]; then

	## ####################################### ##
	# LOCAL -> REMOTE
	InitLog $1
	Sync $DOC_DIR_TO_BCK $REMOTE_HOST:$ROOT_TARGET_BCK/$DOC_TARGET_DIR $BCK_USER
	CloseLog 

else

	echo "[ERROR] Env. Variables are not correctly defined : "  
	echo "[ERROR]    DOC_DIR_TO_BCK : <$DOC_DIR_TO_BCK>"
	echo "[ERROR]    DOC_TARGET_DIR : <$DOC_TARGET_DIR>"
	echo "[ERROR]    BCK_USER       : <$BCK_USER>"
	echo "[ERROR]    SSH_KEY_FILE   : <$SSH_KEY_FILE>"

	exit -1
	
fi

